# @Time  : 2021/7/28 22:12
# @Author: zhanfengzhen
# @Email : zhanfengzhen@126.com
# @File  : basePage.py
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
from appium import webdriver
from appium.webdriver.webdriver import WebDriver


class BasePage():
    #实例化driver
    def __init__(self, driver:WebDriver=None):
        if driver ==None:
            caps = {}
            caps["platformName"] = "Android"
            caps["appPackage"] = "com.tencent.wework"
            caps["appActivity"] = ".launch.LaunchSplashActivity"
            caps["deviceName"] = "ceshi"
            caps["noReset"] = "true"
            caps["skipDeviceInitialization"] = True
            self.driver = webdriver.Remote("http://localhost:4222/wd/hub", caps)
            self.driver.implicitly_wait(5)
        else:
            self.driver = driver

    def close_driver(self):
        self.driver.quit()